package o;

import o.gan.c;

public class fzx {
    static final /* synthetic */ boolean ˊॱ = (!fzx.class.desiredAssertionStatus());
    public int ʻ;
    private final gad ʻॱ = new gad();
    public gba[] ʼ;
    public int ʽ;
    public gaw[] ˊ;
    public gau[] ˋ;
    private final fzq ˋॱ = new fzq();
    public fzt[] ˎ;
    public fyd ˏ;
    private final gan ˏॱ = new gan();
    public int ͺ;
    public gal[] ॱ;
    public int ॱˊ;
    private final c ॱˋ = new c();
    private final gan ॱˎ = new gan();
    public int ॱॱ;
    private final fya ॱᐝ = new fya();
    public int ᐝ;
    private final c ᐝॱ = new c();

    public void ˎ(int i, int i2, int i3, fyd o_fyd) {
        int length;
        this.ᐝ = i;
        this.ͺ = i2;
        this.ॱˊ = i3;
        this.ʽ = 0;
        this.ʻ = 0;
        this.ॱॱ = 0;
        this.ˏ = o_fyd;
        if (this.ˎ == null || this.ᐝ > this.ˎ.length) {
            this.ˎ = new fzt[this.ᐝ];
        }
        if (this.ˊ == null || this.ॱˊ > this.ˊ.length) {
            this.ˊ = new gaw[this.ॱˊ];
        }
        if (this.ॱ == null || this.ͺ > this.ॱ.length) {
            this.ॱ = new gal[this.ͺ];
        }
        if (this.ʼ == null || this.ᐝ > this.ʼ.length) {
            Object obj;
            obj = this.ʼ == null ? new gba[0] : this.ʼ;
            this.ʼ = new gba[this.ᐝ];
            System.arraycopy(obj, 0, this.ʼ, 0, obj.length);
            for (length = obj.length; length < this.ʼ.length; length++) {
                this.ʼ[length] = new gba();
            }
        }
        if (this.ˋ == null || this.ᐝ > this.ˋ.length) {
            obj = this.ˋ == null ? new gau[0] : this.ˋ;
            this.ˋ = new gau[this.ᐝ];
            System.arraycopy(obj, 0, this.ˋ, 0, obj.length);
            for (length = obj.length; length < this.ˋ.length; length++) {
                this.ˋ[length] = new gau();
            }
        }
    }

    public void ˋ() {
        this.ʽ = 0;
        this.ʻ = 0;
        this.ॱॱ = 0;
    }

    public void ˋ(gae o_gae, gag o_gag, fzp o_fzp, boolean z) {
        int i;
        Object obj;
        float f = o_gag.ˎ;
        for (i = 0; i < this.ʽ; i++) {
            fzt o_fzt = this.ˎ[i];
            fzr o_fzr = o_fzt.ʻ;
            fzp o_fzp2 = o_fzr.ˋ;
            float f2 = o_fzr.ॱ;
            fzp o_fzp3 = o_fzt.ʽ;
            float f3 = o_fzt.ॱॱ;
            o_fzr.ˏ.ॱ(o_fzr.ˋ);
            o_fzr.ˎ = o_fzr.ॱ;
            if (o_fzt.ˊ == fzs.DYNAMIC) {
                o_fzp3.ˊ += ((o_fzt.ʾ * o_fzp.ˊ) + (o_fzt.ॱᐝ * o_fzt.ʼ.ˊ)) * f;
                o_fzp3.ॱ += ((o_fzt.ʾ * o_fzp.ॱ) + (o_fzt.ॱᐝ * o_fzt.ʼ.ॱ)) * f;
                f3 += (o_fzt.ʽॱ * f) * o_fzt.ᐝ;
                o_fzp3.ˊ *= 1.0f / (1.0f + (o_fzt.ʿ * f));
                o_fzp3.ॱ *= 1.0f / (1.0f + (o_fzt.ʿ * f));
                f3 *= 1.0f / ((o_fzt.ˈ * f) + 1.0f);
            }
            this.ˋ[i].ˋ.ˊ = o_fzp2.ˊ;
            this.ˋ[i].ˋ.ॱ = o_fzp2.ॱ;
            this.ˋ[i].ˎ = f2;
            this.ʼ[i].ˎ.ˊ = o_fzp3.ˊ;
            this.ʼ[i].ˎ.ॱ = o_fzp3.ॱ;
            this.ʼ[i].ˏ = f3;
        }
        this.ˋॱ.ॱ();
        this.ʻॱ.ॱ = o_gag;
        this.ʻॱ.ˊ = this.ˋ;
        this.ʻॱ.ˋ = this.ʼ;
        this.ᐝॱ.ˎ = o_gag;
        this.ᐝॱ.ॱ = this.ॱ;
        this.ᐝॱ.ˋ = this.ʻ;
        this.ᐝॱ.ˊ = this.ˋ;
        this.ᐝॱ.ˏ = this.ʼ;
        this.ˏॱ.ॱ(this.ᐝॱ);
        this.ˏॱ.ˊ();
        if (o_gag.ॱॱ) {
            this.ˏॱ.ˎ();
        }
        for (i = 0; i < this.ॱॱ; i++) {
            this.ˊ[i].ˋ(this.ʻॱ);
        }
        o_gae.ʼ.ˎ(this.ˋॱ.ˎ());
        this.ˋॱ.ॱ();
        for (i = 0; i < o_gag.ˏ; i++) {
            int i2;
            for (i2 = 0; i2 < this.ॱॱ; i2++) {
                this.ˊ[i2].ˏ(this.ʻॱ);
            }
            this.ˏॱ.ˋ();
        }
        this.ˏॱ.ˏ();
        o_gae.ʻ.ˎ(this.ˋॱ.ˎ());
        for (i = 0; i < this.ʽ; i++) {
            fzp o_fzp4 = this.ˋ[i].ˋ;
            float f4 = this.ˋ[i].ˎ;
            o_fzp2 = this.ʼ[i].ˎ;
            f3 = this.ʼ[i].ˏ;
            f2 = o_fzp2.ˊ * f;
            float f5 = o_fzp2.ॱ * f;
            if ((f2 * f2) + (f5 * f5) > fzo.ˈ) {
                f2 = fzo.ʾ / fzm.ʼ((f2 * f2) + (f5 * f5));
                o_fzp2.ˊ *= f2;
                o_fzp2.ॱ = f2 * o_fzp2.ॱ;
            }
            f2 = f * f3;
            if (f2 * f2 > fzo.ʼॱ) {
                f3 *= fzo.ʿ / fzm.ˏ(f2);
            }
            o_fzp4.ˊ += o_fzp2.ˊ * f;
            o_fzp4.ॱ = (o_fzp2.ॱ * f) + o_fzp4.ॱ;
            this.ˋ[i].ˎ = (f * f3) + f4;
            this.ʼ[i].ˏ = f3;
        }
        this.ˋॱ.ॱ();
        for (i = 0; i < o_gag.ॱ; i++) {
            boolean ॱ = this.ˏॱ.ॱ();
            Object obj2 = 1;
            for (i2 = 0; i2 < this.ॱॱ; i2++) {
                obj2 = (obj2 == null || !this.ˊ[i2].ˎ(this.ʻॱ)) ? null : 1;
            }
            if (ॱ && obj2 != null) {
                obj = 1;
                break;
            }
        }
        obj = null;
        for (i2 = 0; i2 < this.ʽ; i2++) {
            o_fzt = this.ˎ[i2];
            o_fzt.ʻ.ˋ.ˊ = this.ˋ[i2].ˋ.ˊ;
            o_fzt.ʻ.ˋ.ॱ = this.ˋ[i2].ˋ.ॱ;
            o_fzt.ʻ.ॱ = this.ˋ[i2].ˎ;
            o_fzt.ʽ.ˊ = this.ʼ[i2].ˎ.ˊ;
            o_fzt.ʽ.ॱ = this.ʼ[i2].ˎ.ॱ;
            o_fzt.ॱॱ = this.ʼ[i2].ˏ;
            o_fzt.ˋॱ();
        }
        o_gae.ॱॱ.ˎ(this.ˋॱ.ˎ());
        ˋ(this.ˏॱ.ˋ);
        if (z) {
            float f6 = Float.MAX_VALUE;
            f4 = fzo.ˊˋ * fzo.ˊˋ;
            float f7 = fzo.ˋˊ * fzo.ˋˊ;
            for (i2 = 0; i2 < this.ʽ; i2++) {
                fzt o_fzt2 = this.ˎ[i2];
                if (o_fzt2.ʽ() != fzs.STATIC) {
                    if ((o_fzt2.ˏ & 4) == 0 || o_fzt2.ॱॱ * o_fzt2.ॱॱ > f7 || fzp.ˎ(o_fzt2.ʽ, o_fzt2.ʽ) > f4) {
                        o_fzt2.ʼॱ = 0.0f;
                        f6 = 0.0f;
                    } else {
                        o_fzt2.ʼॱ += f;
                        f6 = fzm.ॱ(f6, o_fzt2.ʼॱ);
                    }
                }
            }
            if (f6 >= fzo.ˊᐝ && r0 != null) {
                for (i = 0; i < this.ʽ; i++) {
                    this.ˎ[i].ˏ(false);
                }
            }
        }
    }

    public void ˎ(gag o_gag, int i, int i2) {
        int i3 = 0;
        if (!ˊॱ && i >= this.ʽ) {
            throw new AssertionError();
        } else if (ˊॱ || i2 < this.ʽ) {
            int i4;
            for (i4 = 0; i4 < this.ʽ; i4++) {
                this.ˋ[i4].ˋ.ˊ = this.ˎ[i4].ʻ.ˋ.ˊ;
                this.ˋ[i4].ˋ.ॱ = this.ˎ[i4].ʻ.ˋ.ॱ;
                this.ˋ[i4].ˎ = this.ˎ[i4].ʻ.ॱ;
                this.ʼ[i4].ˎ.ˊ = this.ˎ[i4].ʽ.ˊ;
                this.ʼ[i4].ˎ.ॱ = this.ˎ[i4].ʽ.ॱ;
                this.ʼ[i4].ˏ = this.ˎ[i4].ॱॱ;
            }
            this.ॱˋ.ॱ = this.ॱ;
            this.ॱˋ.ˋ = this.ʻ;
            this.ॱˋ.ˎ = o_gag;
            this.ॱˋ.ˊ = this.ˋ;
            this.ॱˋ.ˏ = this.ʼ;
            this.ॱˎ.ॱ(this.ॱˋ);
            for (i4 = 0; i4 < o_gag.ॱ && !this.ॱˎ.ॱ(i, i2); i4++) {
            }
            this.ˎ[i].ʻ.ˏ.ˊ = this.ˋ[i].ˋ.ˊ;
            this.ˎ[i].ʻ.ˏ.ॱ = this.ˋ[i].ˋ.ॱ;
            this.ˎ[i].ʻ.ˎ = this.ˋ[i].ˎ;
            this.ˎ[i2].ʻ.ˏ.ॱ(this.ˋ[i2].ˋ);
            this.ˎ[i2].ʻ.ˎ = this.ˋ[i2].ˎ;
            this.ॱˎ.ˊ();
            for (i4 = 0; i4 < o_gag.ˏ; i4++) {
                this.ॱˎ.ˋ();
            }
            float f = o_gag.ˎ;
            while (i3 < this.ʽ) {
                fzp o_fzp = this.ˋ[i3].ˋ;
                float f2 = this.ˋ[i3].ˎ;
                fzp o_fzp2 = this.ʼ[i3].ˎ;
                float f3 = this.ʼ[i3].ˏ;
                float f4 = o_fzp2.ˊ * f;
                float f5 = o_fzp2.ॱ * f;
                if ((f4 * f4) + (f5 * f5) > fzo.ˈ) {
                    o_fzp2.ˊ(fzo.ʾ / fzm.ʼ((f4 * f4) + (f5 * f5)));
                }
                f4 = f * f3;
                if (f4 * f4 > fzo.ʼॱ) {
                    f3 *= fzo.ʿ / fzm.ˏ(f4);
                }
                o_fzp.ˊ += o_fzp2.ˊ * f;
                o_fzp.ॱ += o_fzp2.ॱ * f;
                f2 += f * f3;
                this.ˋ[i3].ˋ.ˊ = o_fzp.ˊ;
                this.ˋ[i3].ˋ.ॱ = o_fzp.ॱ;
                this.ˋ[i3].ˎ = f2;
                this.ʼ[i3].ˎ.ˊ = o_fzp2.ˊ;
                this.ʼ[i3].ˎ.ॱ = o_fzp2.ॱ;
                this.ʼ[i3].ˏ = f3;
                fzt o_fzt = this.ˎ[i3];
                o_fzt.ʻ.ˋ.ˊ = o_fzp.ˊ;
                o_fzt.ʻ.ˋ.ॱ = o_fzp.ॱ;
                o_fzt.ʻ.ॱ = f2;
                o_fzt.ʽ.ˊ = o_fzp2.ˊ;
                o_fzt.ʽ.ॱ = o_fzp2.ॱ;
                o_fzt.ॱॱ = f3;
                o_fzt.ˋॱ();
                i3++;
            }
            ˋ(this.ॱˎ.ˋ);
        } else {
            throw new AssertionError();
        }
    }

    public void ˊ(fzt o_fzt) {
        if (ˊॱ || this.ʽ < this.ᐝ) {
            o_fzt.ˎ = this.ʽ;
            this.ˎ[this.ʽ] = o_fzt;
            this.ʽ++;
            return;
        }
        throw new AssertionError();
    }

    public void ˎ(gal o_gal) {
        if (ˊॱ || this.ʻ < this.ͺ) {
            gal[] o_galArr = this.ॱ;
            int i = this.ʻ;
            this.ʻ = i + 1;
            o_galArr[i] = o_gal;
            return;
        }
        throw new AssertionError();
    }

    public void ˋ(gaw o_gaw) {
        if (ˊॱ || this.ॱॱ < this.ॱˊ) {
            gaw[] o_gawArr = this.ˊ;
            int i = this.ॱॱ;
            this.ॱॱ = i + 1;
            o_gawArr[i] = o_gaw;
            return;
        }
        throw new AssertionError();
    }

    public void ˋ(gaq[] o_gaqArr) {
        if (this.ˏ != null) {
            for (int i = 0; i < this.ʻ; i++) {
                gal o_gal = this.ॱ[i];
                gaq o_gaq = o_gaqArr[i];
                this.ॱᐝ.ॱ = o_gaq.ॱˊ;
                for (int i2 = 0; i2 < o_gaq.ॱˊ; i2++) {
                    this.ॱᐝ.ˋ[i2] = o_gaq.ॱ[i2].ˎ;
                    this.ॱᐝ.ˊ[i2] = o_gaq.ॱ[i2].ˊ;
                }
                this.ˏ.ˊ(o_gal, this.ॱᐝ);
            }
        }
    }
}
